//
//  RZVoiceRecorder.h
//  RZIM
//
//  Created by reyzhang on 2021/8/18.
//  语音录制工具类

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@protocol RZVoiceRecorderDelegate;

@interface RZVoiceRecorder : NSObject
@property (nonatomic, readonly) BOOL isRecording; //录制状态

+ (RZVoiceRecorder *)defaultVoiceRecorder;


- (BOOL)startRecordWithObserver:(id<RZVoiceRecorderDelegate>)observer;

- (BOOL)cancelRecord;

- (void)stopRecord:(void (^)(NSData *wavData, NSURL *wavLocalFile,NSTimeInterval secs))compeletion;

- (CGFloat)updateMeters;
@end



@protocol RZVoiceRecorderDelegate <NSObject>

//结束录制后的回调
- (void)RZVoiceAudioRecorderDidFinishRecording:(BOOL)success;
//编码出错回调
- (void)RZVoiceAudioRecorderEncodeErrorDidOccur:(NSError *)error;

@end


NS_ASSUME_NONNULL_END
